/*
 * Copyright (c) 2022 Huawei Technologies Co.,Ltd.
 *
 * openGauss is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *
 *          http://license.coscl.org.cn/MulanPSL2
 *
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

/**
 * @owner: opentestcase033
 * @time:  2023/7/12
 */

public class Opengauss_SharedStorage_MultiNodeWrite_Case0038 {
    public static void main(String[] args) throws Exception {
        if (args.length < 4) {
            System.out.print("need para: host:ip,dbname,user,password");
        }
        else {
            Connection conn = DriverManager.getConnection(
                    "jdbc:postgresql://" + args[0] + "/" + args[1] + "?LoggerLevel=off", args[2], args[3]);
            Statement stmt = null;
            try {
                stmt = conn.createStatement();
                ResultSet rs = stmt.executeQuery("select * from t_multi_node_write_0038;");
                while (rs.next()) {
                    System.out.println(rs.getInt("id") + " | " + rs.getString("name"));
                }
                rs.close();
                stmt.close();
                conn.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
